/**
 * Services.Foursquare Package
 */

(function() {

var apikey = '8ae557e7748e49ff844a6c374db54651';

var foursquare = new mb.UnitActionPackage('Services.Foursqare', {
  label : 'Foursquare',  
  icon : 'http://www.foursqare.com/favicon.ico'
});

foursquare.register(new mb.UnitAction({
  type : 'CheckinHistory',
  label : 'Foursquare Checkin History',
  description : 'Your Foursquare Checkins',
  allowDynamicInput : true,
  inputs : [
    { name : 'id',
      label : 'foursquare user id',
      type : 'String' }
  ]
  ,
  execute : function(request, callback) {
    var url = 'http://api.foursquare.com/v1/history.json';
    if (request.params['id']) {
      //url += 'id='+encodeURIComponent(request.params['id'].join(','))+'&'; 
	}
    mb.ajax.jsonp.invoke(url, callback, { jsonpParam : 'jsoncallback' }); 
  }
  

}));

mb.packages.register(foursquare, 'foursquare.js');


})();